<?php
$i=0;
foreach ($contenido->result() as $fila):
         $cartel = str_replace(array("\n", "\r"), array('\n', '\r'), $fila->texto); ?>
            <script type="text/javascript">
                $(document).ready(function(){
                    $('#b<?=$i?>').tooltip ('<?=$cartel?>', { width: 600, click:1, style: 'alert', sticky: 1 });
                });
            </script>
<?php
    $i++;

endforeach;?>




<div class="yui-g">
    <table id="editgrid"></table>
    <div id="pager"></div>
    <br /> <a href="javascript:void(0)" id="s1">Set new url</a>
</div>
<script type="text/javascript">
    $(document).ready(function(){
        jQuery("#editgrid").jqGrid({
            url:'<?=base_url();?>index.php/admin/noticias/post',
            datatype: 'json',
            mtype: 'POST',
            colNames:['id','Nombre','Nombre de usario','Email','Telefono','Direccion','Ciudad','Proincia','Clave','Tipo','Envio','Permisos','Tarjeta'],
            colModel :[
                {name:'id', index:'id', width:90,editable:false,editoptions:{size:10}},
                {name:'name', index:'name', width:120,editable:true,editoptions:{size:20}},
                {name:'username', index:'username', width:120,editable:true,editoptions:{size:20}, align:'right'},
                {name:'email', index:'email', width:80,editable:true,editoptions:{size:20}, align:'right'},
                {name:'phone_1', index:'phone_1', width:80,editable:true,editoptions:{size:20}, align:'right'},
                {name:'address_1', index:'address_1', width:80,editable:true,editoptions:{size:20}, align:'right'},
                {name:'city', index:'city', width:80,editable:true,editoptions:{size:20}, align:'right'},
                {name:'state', index:'state', width:80,editable:true,editoptions:{size:20}, align:'right'},
                {name:'password', index:'password', width:80,editable:true,editoptions:{size:20}, align:'right',edittype:'password'},
                {name:'usertype', index:'usertype', width:90,editable:true,edittype:"select",editoptions:{value:"bajo:bajo;medio:medio;alto:alto;"}},
                {name:'extra_field_2', index:'extra_field_2', width:80,editable:true,editoptions:{size:20}, align:'right'},
                {name:'perms',index:'perms', width:90,editable:true,edittype:"select",editoptions:{value:"comun:comun;editor:editor;admin:admin;"}},
                {name:'tarjeta', index:'perms', width:80,editable:false,editoptions:{size:20}, align:'right'},
            ],
            pager: '#pager',
            rowNum:20,
            rowList:[10,20,30],
            sortname: 'nombre',
            sortorder: 'desc',
            viewrecords: true,
            caption: 'Noticias',
            height:'100%',
            width:'100%',
            editurl:"<?=base_url();?>index.php/admin/usuarios/guardar_1"

        });
        jQuery("#editgrid").jqGrid('navGrid',"#pager",{edit:true,add:true,del:true});
    });
</script>



<!-- <div class="yui-g">

<?php if($this->session->userdata('logged_in')):?>
    <div id="contenido" >
        <div id="menuh">
            <ul>
                <li><a href="<?=base_url();?>index.php/admin/noticias/crear/"><?=lang('agregar_noticias');?></a></li>
            </ul>
        </div>
        <div style="clear : left; height:5px;"></div>
        <table class="espaciado2" border="1" width="90%">
            <tr>
                <th style="text-align:center;"><?=lang('nombre_noticia');?></th>
                <th style="text-align:center;"><?=lang('texto_noticia');?></th>
                <th style="text-align:center;"><?=lang('tipo_noticia');?></th>
                <th style="text-align:center;"><?=lang('peso_noticia');?></th>
                <th style="text-align:center;">Empresa</th>
                <th style="text-align:center;"><?=lang('editar_noticia');?></th>
                <th style="text-align:center;"><?=lang('eliminar_noticia');?></th>
            </tr>
    <?php
    $i=0;
    foreach ($contenido->result() as $fila):
        $i++;
        ?>
            <tr>
                <td><?=$fila->nombre?></td>
                <td><a href="#" id="b<?=$i?>">clic para ver</a></td>
        <?php $cartel = str_replace(array("\n", "\r"), array('\n', '\r'), $fila->texto); ?>
            <script type="text/javascript">

                $(document).ready(function(){
                    $('#b<?=$i?>').tooltip ('<?=$cartel?>', { width: 600, click:1, style: 'alert', sticky: 1 });
                });
            </script>

            <td><?=$fila->tipo?></td>
            <td><?=$fila->peso?></td>
            <td><?=$fila->empresa?></td>
            <td><a href="<?=base_url();?>index.php/admin/noticias/editar/<?=$fila->id?>">editar</a></td>
            <td><a href="<?=base_url();?>index.php/admin/noticias/eliminar/<?=$fila->id?>">eliminar</a></td>
            </tr>
            <tr><td colspan="6"></td></tr>
    <?php endforeach;?>
        </table>
    </div>
<?php endif;?>

</div>
-->
